import request from '@/utils/request'

// 移动端：按SN查询杂项出库单
export function getMiscIssueBySn(sn) {
  return request({
    url: '/mobile/wm/miscissue/getBySn/' + sn,
    method: 'get'
  })
}

// 移动端：按单号查询杂项出库单
export function getMiscIssueByCode(issueCode) {
  return request({
    url: '/mobile/wm/miscissue/getByCode/' + issueCode,
    method: 'get'
  })
}

// 移动端：行拣货保存
export function pickMiscIssueLine(data) {
  return request({
    url: '/mobile/wm/miscissue/line/pick',
    method: 'post',
    data: data
  })
}

// 移动端：查询杂项出库明细列表
export function listMiscIssueDetails(query) {
  return request({
    url: '/mobile/wm/miscissue/detail/list',
    method: 'get',
    params: query
  })
}

// 移动端：批量保存SN/批次出库明细
export function batchSaveMiscIssueBySn(data) {
  return request({
    url: '/mobile/wm/miscissue/detail/batchBySn',
    method: 'post',
    data: data
  })
}

// 移动端：执行出库
export function executeMiscIssueMobile(issueId) {
  return request({
    url: '/mobile/wm/miscissue/execute/' + issueId,
    method: 'put'
  })
}

// Web端接口保留（兼容）
export function listMiscIssue(query) {
  return request({
    url: '/mes/wm/miscissue/list',
    method: 'get',
    params: query
  })
}

export function getMiscIssue(issueId) {
  return request({
    url: '/mes/wm/miscissue/' + issueId,
    method: 'get'
  })
}

export function executeMiscIssue(issueId) {
  return request({
    url: '/mes/wm/miscissue/' + issueId,
    method: 'put'
  })
}

export function listMiscIssueLine(query) {
  return request({
    url: '/mes/wm/miscissueline/list',
    method: 'get',
    params: query
  })
}